<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<script
	src="/resources/admin/lagu/lib/formvalidator/jquery.validationEngine.js"></script>
<script
	src="/resources/admin/lagu/lib/formvalidator/jquery.validationEngine-en.js"></script>
<link rel="stylesheet"
	href="/resources/admin/lagu/lib/formvalidator/validationEngine.jquery.css"
	type="text/css" media="screen" />
<script type="text/javascript">
	$(document).ready(function() {
		function data(jsonData) {
			$("#articles-single-id").attr("value",jsonData.id);
			$("#articles-single-title").attr("value",jsonData.title);
			$("#articles-single-content").attr("value",jsonData.content);
		}
		if (CKEDITOR.instances['articles-single-content']) {
			CKEDITOR.remove(CKEDITOR.instances['articles-single-content']);
		}
		var editor = CKEDITOR.replace('articles-single-content');
		$("#articles-single-form").validationEngine({
			promptPosition : "topLeft",
			onValidationComplete : function(form, status) {
				if (status == true) {
					$('#articles-single-content').attr(
							"value",CKEDITOR.instances["articles-single-content"].getData());
					LG.articlesPost($("#articles-single-form").serialize(),function(json){
						if (json.success) {
							data(eval("("+ json.data+ ")"));
							$("#articles-single-title").validationEngine("showPrompt","发布成功","pass");
						} else {
							$("#articles-single-title").validationEngine("showPrompt","errorCode:"+json.errorCode+";message:"+json.message+"","error");
						}
					});
				}
			}
		});
		$(".tabsB").flowtabs("div.content_panes > div");
	});
</script>
<form action="" id="articles-single-form" onsubmit="return false;">
	<input type="hidden" id="articles-single-id" name="id" value="">
	<div class="cf sepH_c">
		<div id="content_actions" class="fr">
			<button class="btn btn_d">保存</button>
		</div>
	</div>
	<ul class="tabsB cf">
		<li><a href="#tab-1" class="current">内容</a></li>
		<li><a href="#tab-2" class="">配置</a></li>
	</ul>
	<div class="msg_box msg_error" id="form_a_errors" style="display: none"></div>
	<div class="content_panes">
		<div id="tab-1" style="display: block;">
			<div class="formEl_a">
				<fieldset>
					<div class="sepH_b">
						<label for="title" class="lbl_a">标题</label> <input type="text"
							id="articles-single-title" name="title"
							class="inpt_a validate[required]" style="width: 97%">
					</div>
					<div class="sepH_c">
						<label for="text" class="lbl_a">内容</label>
						<textarea id="articles-single-content" name="content"></textarea>
					</div>
				</fieldset>
			</div>
		</div>
		<div id="tab-2" class="cf formEl_a" style="display: none;">
			<div class="sepH_b cf">
				<div class="dp33">
					<fieldset>
						<legend>Edit permisions:</legend>
						<div class="sepH_a">
							<input type="checkbox" class="inpt_c" id="eadmin"
								name="editGroup"> <label for="eadmin" class="lbl_c">Administrator</label>
						</div>
						<div>
							<input type="checkbox" class="inpt_c" id="eeditor"
								name="editGroup"> <label for="eeditor" class="lbl_c">Content
								editor</label>
						</div>
					</fieldset>
				</div>
				<div class="dp33">
					<fieldset>
						<legend>Delete permisions:</legend>
						<div class="sepH_a">
							<input type="checkbox" class="inpt_c" id="dadmin"> <label
								for="dadmin" class="lbl_c">Administrator</label>
						</div>
						<div>
							<input type="checkbox" class="inpt_c" id="deditor"> <label
								for="deditor" class="lbl_c">Content editor</label>
						</div>
					</fieldset>
				</div>
			</div>
			<div class="sepH_b cf">
				<div class="dp100">
					<input type="checkbox" class="inpt_c" id="guests"><label
						for="guests" class="lbl_c">Show to guests only</label> <span
						class="f_help">Hide the page if there is an authenticated
						user.</span>
				</div>
			</div>
		</div>
	</div>
</form>